<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>常见指令使用介绍</title>
<style>
    .curr{
       color:green;
       font-size: 18px;   
       background: yellow  
    }
</style>
</head>
<body ng-app='app'>
    <div ng-controller="demoCtrl">
        <input ng-class="{curr:isClass}" ng-style="{border:'1px solid red',padding:'5px'}" ng-focus="focus" ng-readonly="read" ng-disabled="disable" type="text" placeholder="请输入内容">
        <button ng-click="setReadonly()">设置只读</button>
        <button ng-click="setDisabled()">设置禁用</button>
        <button ng-click="setClass()">设置class</button>
    </div>
</body>
<script src="./libs/js/angular-1.6.9.min.js"></script>
<script>
    var app=angular.module('app',[]);
    app.controller('demoCtrl',['$scope',function($scope){
        $scope.read=false;
        $scope.disable=false;
        $scope.focus=false;
        $scope.isClass=false;
        $scope.setReadonly=function(){
            $scope.read=!$scope.read;
        }
        $scope.setDisabled=function(){
            $scope.disable=!$scope.disable;
        }
        $scope.setClass=function(){
            $scope.isClass=!$scope.isClass;
        }

    }]);
</script>
</html>